<%@ page language="java" contentType="text/html;charset=utf-8"%>
<%
String userName = (String)request.getSession().getAttribute((String)com.wing.common.Constants.SESSION_SITE_USER_NAME);
String userId = (String)request.getSession().getAttribute((String)com.wing.common.Constants.SESSION_SITE_USER_ID);
String type_id = request.getParameter("type_id");
String typen = request.getParameter("typen");
String inforField = request.getParameter("inforField");
%>
<script type="text/javascript">
	function login(){
		var options = {
			type: 'POST',
			async: false,
			dataType: 'content-type',
			success: function(msg) {
				if(msg=="success"){
				window.location.reload();
				}else{
					alert("用户名或密码错误！");
				}
			}
		}
		$('#loginform').ajaxSubmit(options);
	}
	function logout(){
		$.ajax({
			url :"<%=request.getContextPath() %>/ext/site_user/logout", //要访问的后台地址
		    type : 'post', //使用get方法访问后台
		    success : function(data){
	   			document.location.reload();
		    }
		});	 
	}
	function zhuce(){
		opendailog("{src:'register',title:'用户注册',width:540,height:260,savefunc:'savefunc1',ok:'3'}",window);
	}
			
	function savefunc1(frame){
		var retv = frame.contentWindow.save()
		if(retv=="success"){
			alert("保存成功！");
			window.location.reload();
		}
		return retv;
	}
	
	var mgrmysite = function(){
  		$.ajax({
		   type: "POST",
		   url: "/sys/dispatch",   
		   data: "login_code=qzw_<%=userName %>",
		   dataType: 'json',
		   success: function(data){
		     	if(data.status=="failure"){
					if(data.code=="nosite"){
						alert("对不起您还没有自己的网站！");
					}
				}else{
					window.open("http://"+data.url+"/sys/get/login?a=y&l="+data.l+"&p="+data.p);
				}
		   }
		}); 
	}
	var openmysite = function(){
  		$.ajax({
		   type: "POST",
		   url: "/sys/dispatch",   
		   data: "login_code=qzw_<%=userName %>",
		   dataType: 'json',
		   success: function(data){
		     	if(data.status=="failure"){
					if(data.code=="nosite"){
						alert("对不起您还没有自己的网站！");
					}
				}else{
					window.open("http://"+data.url);
				}
		   }
		}); 
	}
</script>
<div class="header">
	<div class="land">
		<div class="left">
		<%if(userId!=null){
	  		%>
  			<a href="#" onclick="logout()" class="cred">[退出]</a>
			<bdo style="color:#ea0001"><img src="<%=request.getContextPath() %>/site/${SiteAccessPath}/images/land_nextHY.gif" width="8" height="10" style="margin-right:4px;" /><%=userName %></bdo>
			&nbsp;&nbsp;欢迎登录企助网！<span>
	  		<a href="#" onclick="mgrmysite()" class="cred">管理我的网站</a>
	  		<a href="#" onclick="openmysite()" class="cred">进入我的网站</a>
	  		</span>
	  		<%
	  	}else{
	  		%>
	  		<form id="loginform"  method="post" action="<%=request.getContextPath() %>/ext/site_user/login">
	  		<input type="hidden" name="site_id" value="000000020012e664bc4c8"/>
	  		<span class="left">
	  		用户名：
	  		<input name="login_name" type="text" class="land_input "
				id="textfield" value="" />
			密码：
			<input name="password" type="password" class="land_input "
				id="textfield" value="" />
			</span>
			<input type="button" name="button" id="button" value="" onclick="login()"
				class="land_submit left" border="0" />
			<a href="javascript:void(0)" onclick="zhuce()" style="color: #d40009">注册</a>
			</form>
	  	<%
	  	} 
	  	%>	
		</div>
		<span class="right"><a href="#">中文</a>|<a href="#">英文</a></span>
	</div>
</div>
<div style="clear: both"></div>
<div class="logo">
	<img src="<%=request.getContextPath() %>/site/${SiteAccessPath}/images/logo.jpg" width="191" height="83"
		class="left logo_pic" alt="logo" />
	<div style="width: 306px; float: left; height: 100px;"></div>
	<div class="left search">
		<input name="textfield3" type="text" class="search_input left"
			id="textfield3" value="请输入您所查询的关键字！" />
		<input type="submit" name="button2" id="button2" value=""
			class="search_submit right" />
	</div>
	<span><img src="<%=request.getContextPath() %>/site/${SiteAccessPath}/images/people.jpg" width="131" height="105" />
	</span>
</div>
<div style="clear: both"></div>